package stringExertises;

/**
 * @author: snail_mount
 * @date: 20/2/2 23:58
 * @description: 比较两个相等的字符串的地址是否相同
 */
public class CompareTheAddress {
    public static void main(String[] args) {
        String s1 = "abc";
        String s2 = "abc";
        String s4 = "a";
        String s3 = new String("abc");
        System.out.println(s1 == s2);
        System.out.println(System.identityHashCode(s1));
        System.out.println(System.identityHashCode(s4));
        System.out.println(System.identityHashCode(s2));
        System.out.println(System.identityHashCode(s3));
    }
}
